#include <bits/stdc++.h>
using namespace std;
const int N=100010;
bool vis[N];
int a[N];
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	if(n<=5){
		cout<<1<<" ";
		vis[1]=1;
		if(a[1]!=a[2]) {
			cout<<2<<" ";
			vis[2]=1;
		}
		if(a[2]!=a[3]) {
			cout<<3<<" ";
			vis[3]=1;
		}
		if(a[3]!=a[4]) {
			cout<<4<<" ";
			vis[4]=1;
		}
		if(a[4]!=a[5]) {
			cout<<5<<" ";
			vis[5]=1;
		}
		cout<<endl;
		for(int i=1;i<=n;i++){
			if(vis[i]==0) cout<<i<<" "; 
		}
		cout<<endl;
	}
	return 0;
}
